package com.pc.tas.servlet;

import com.pc.tas.util.SpringBeanUtil;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

public class StartupServlet extends HttpServlet implements
		ServletContextListener {


	private static final long serialVersionUID = 1L;

	public void destroy() {
		super.destroy(); 		
	}
	
	public void init() throws ServletException {
		ServletContext context = getServletContext();
	    WebApplicationContext appCtx = WebApplicationContextUtils.getWebApplicationContext(context);
	    SpringBeanUtil.setAppCtx(appCtx);
	}

	public void contextDestroyed(ServletContextEvent sce) {
		
	}

	public void contextInitialized(ServletContextEvent sce) {
		
	}

}
